package org.merak;

import org.merak.core.Application;
import org.merak.core.configuration.plugin.PluginSet;
import org.merak.core.configuration.plugin.Service;
import org.merak.core.configuration.web.mvc.ControlSettings;
import org.merak.core.configuration.web.mvc.ViewSettings;
import org.merak.core.model.parameter.Property;

public class TestaApplication {

	//~Attributes /////////////////////////////////////////////////////////////////
	//*****************************************************************************
	//~Methods ////////////////////////////////////////////////////////////////////
	//*****************************************************************************
	public static void main(String args[]) throws Exception {

		String space = "    ";

		System.out.println("\n");
		PluginSet plugins = Application.getPluginSet("org.indt.dsnps.dcidcr.persistence.spi");
		System.out.println( "[PluginSet] : " + plugins.getSpiPackage() + " { " );
		for (Service service : plugins) {
			System.out.println( "    " + service.getName() + " = " + service.getProvider() );
		}
		System.out.println( "}" );

		plugins = Application.getPluginSet("org.indt.dsnps.dcidcr.engine.security.spi");
		System.out.println( "[PluginSet] : " + plugins.getSpiPackage() + " { " );
		for (Service service : plugins) {
			System.out.println( "    " + service.getName() + " = " + service.getProvider() );
		}
		System.out.println( "}" );

		System.out.println("[PropertySet] {");
		for (Property p : Application.getProperties()) {
			System.out.println( "    " +  p.getName() + " = " + p.getValue() );
		}
		System.out.println( "}" );

		System.out.println("[SystemPropertySet] {");
		for (Property p : Application.getSystemProperties()) {
			System.out.println( "    " +  p.getName() + " = " + p.getValue() );
		}
		System.out.println( "}" );

		ControlSettings control =  Application.getConfiguration().getWebMVC().getControl();
		ViewSettings    view    =  Application.getConfiguration().getWebMVC().getView();
		System.out.println("[WebMVC] {");
		System.out.println( space + control.getBusiness().getPackage()  );
		System.out.println( space + control.getBusiness().getParameter()     );
		System.out.println( space + control.getSecurity().getSessionAccountKey());
		System.out.println( space + control.getExceptions().getExecutionErrorLogic());
		System.out.println( space + control.getExceptions().getNoAuthenticationLogic());
		System.out.println( space + control.getExceptions().getNoAuthorizationLogic());
		System.out.println( space + control.getExceptions().getExpiredSessionLogic());
		System.out.println( space + view.getPackage() );
		System.out.println( space + view.getCacheControl() );
		System.out.println( space + view.getContentType() );
		System.out.println( "}" );


	}
	/*****************************************************************************/

}
